package com.bjpowernode.task;

import com.bjpowernode.api.service.IncomeService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component("taskManager")
public class TaskManager {
    /*@Scheduled(cron = "0/5 * * * * ? ")
    public void testCorn(){
        System.out.println("执行了定时任务---->"+new Date());
    }*/
    //生成收益计划
    @DubboReference(interfaceClass = IncomeService.class,version = "1.0")
    private IncomeService incomeService;
    /*生成收益计划*/
    @Scheduled(cron = "0 0 1 * * ?")
    public void invokeGenerateIncomePlan(){
        incomeService.generateIncomePlan();
    }
    /*生成收益返还*/
    @Scheduled(cron = "0 0 2 * * ?")
    public void invokeGenerateIncomeBack(){
        incomeService.generateIncomeBack();
    }
}
